package com.skynet.amqp.perfect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Configuration;

import java.lang.reflect.Method;

@Configuration
@AutoConfigureAfter(PerfectRabbitAutoConfiguration.class)
@Aspect
@SuppressWarnings("ALL")
public class PerfectRabbitAspectAutoConfiguraion {

    private static final Logger log = LoggerFactory.getLogger(PerfectRabbitAspectAutoConfiguraion.class);

    @Pointcut("@annotation(com.skynet.amqp.perfect.MessageReceive)")
    public void pointCut() {

    }

    @Around("pointCut()")
    public Object around(ProceedingJoinPoint joinPoint) {

        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();


        try {
            return joinPoint.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }

        return null;
    }


}
